# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2021年07月09日
"""
from docx import Document
import re
from docx.enum.style import WD_STYLE_TYPE
file = Document(".\练习\练习3.docx")
# 读取标题
# for para in file.paragraphs:
# 	if para.style.name == "Heading 2":
# 		print(para.text)

# 读取所有标题
# for para in file.paragraphs:
# 	if re.match("^Heading \d+$",para.style.name):
# 		print(para.text)

# 读取正文内容
# for para in file.paragraphs:
# 	if para.style.name == 'Normal':
# 		print(para.text)

# 读取所有标题名称
title = file.styles
for i in title:
	if i.type == WD_STYLE_TYPE.PARAGRAPH:
		print(i.name)
